package java基础.operator;

/**
 * @author IT_Jay
 * @date 2021/11/29 18:34
 */

public class Demo05 {
    //逻辑运算符
    public static void main(String[] args) {
        //与(and)、或(or)、非(not)

        boolean a = true;
        boolean b = false;

        System.out.println("a && b:"+ (a && b));            //逻辑与运算：全1为1
        System.out.println("a || b:"+ (a || b));            //逻辑或运算：全0为0
        System.out.println(" ! (a && b):"+ !(a && b));      //取反

        //短路运算
        int c = 5;
        boolean d = (c < 4) && (c++<4);
        System.out.println(d);
        System.out.println(c);
    }
}
